#ifndef	_OSSCHEDULER_H_
#define	_OSSCHEDULER_H_

/* A scheduler wrapper that can check if a thread is blocked or not */

#include "OSThread.h"
#include "Node.h"
#include "ThreadTable.h"
class Network;
class ThreadTable;
class Node;

class OSScheduler {
protected:
    /* Will be used to verify if the thread is blocked or not */
    int m_curThreadPhase;

    Node* m_curThread;

    Network* network;

    ThreadTable* tt;

    unsigned int totalContextSwitches;

    /* Checks if the current thread is blocked or not.
     * Returns true if it is blocked, and false otherwise */
    bool checkThreadBlocked();

    /* A notification that the current running thread has changed
     * to the given thread. */
    void notifyThreadChange(Node* newThread);

    virtual void childReset()=0;

public:
    OSScheduler(Network* network);

    virtual ~OSScheduler() {
    }

    virtual void doScheduling(bool deliveredMsg)=0;

    bool currThreadStable();

    unsigned int getTotalContextSwitches();

    int getTotalMsgQuantaGiven();

    string* getThreadTableString();

    void reset();
};


#endif	//_OSSCHEDULER_H_

